<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <div>姓：<input type="text" v-model="firstName"></div>
    <div>名：<input type="text" v-model="lastName"></div>
    <div>全名：{{fullName}}</div>
</div>
<script src="../JavaScript/vue.js"></script>
<script>
    const vm = new Vue({
        el: "#app",
        data: {
            firstName: "陶",
            lastName: "品奇",
            fullName: "陶-品奇"
        },
        watch: {
            firstName(newV, oldV) {
                setTimeout(() => {
                    this.fullName = newV + "-" + this.lastName
                }, 2000)
            },
            lastName(newV, oldV) {
                this.fullName = this.firstName + "-" + newV
            }
        }
    })
</script>
</body>
</html>
